import { request } from '@/http/axios';
import { IBase, IRecords } from '../app';

export interface IMenu extends IBase{
  id?: number;
  menuName: string;
  parentId: number;
  parentName: string;
  url: string;
}

function upgrade(data) {
  return request({
    url: '/sys/menu/upgrade',
    method: 'POST',
    data
  });
}

function del(id) {
  return request({
    url: '/sys/menu/del',
    method: 'get',
    params: {
      id
    }
  });
}

function records(data) {
  console.log('records');
  return request<IRecords<IMenu>>({
    url: '/sys/menu/records',
    method: 'POST',
    data
  });
}

export const menuModel = {
  upgrade,
  del,
  records
};
